import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../styles/index.dart';




class Loading {
  static void showLoading({String? message}) {
    EasyLoading.show(
      status: message ?? 'Loading...', // 显示的文本
      maskType: EasyLoadingMaskType.clear, // 遮罩层类型：black 半透明黑色，clear 透明，custom 自定义，none 无遮罩
      dismissOnTap: false,  // 点击是否关闭
      // indicator: CircularProgressIndicator(), // 自定义加载指示器
      // animationStyle: EasyLoadingAnimationStyle.opacity, // 动画样式
      // toastPosition: EasyLoadingToastPosition.center, // toast位置
    );
  }

  static void dismissLoading() {
    EasyLoading.dismiss();
  }

  static void init() {
    EasyLoading.instance
      ..displayDuration = const Duration(milliseconds: 2000)
      ..loadingStyle = EasyLoadingStyle.custom
      ..backgroundColor = const Color.fromARGB(150, 255, 255, 255)
      ..indicatorColor = Colors.white
      ..textColor = Colors.white
      ..indicatorType = EasyLoadingIndicatorType.fadingCircle;
  }
}